/**
 * Copyright © 2009 Qasky. All rights reserved.
 *
 * 使用 VueX 进行状态管理
 *
 * @author Wang Hongya
 * @version 0.0.0 2019/10/14
 *
 * History:
 * (author, date, desc)
 * (Wang Hongya, 20191014, 添加注释)
 */
import Vue from 'vue';
import Vuex from 'vuex';

import app from './app';
import user from './user';
import sysAuditLog from "./sysAuditLog";
import sysConfigs from "./sysConfigs";
import sysResManager from "./sysResManager";
import sysResAudit from "./sysResAudit";
import sysDict from "./sysDict";
import sysRole from "./sysRole";
import sysOrg from "./sysOrg";
import sysAtta from "./sysAtta";
import common from "./common";
import authorizeUKey from "./authorizeUKey";

Vue.use (Vuex)

export default new Vuex.Store({
    state: {
        httpError: {
            hasError: false,
            status: '',
            statusText: ''
        }
    },
    mutations: {
        ON_HTTP_ERROR(state, payload) {
            state.httpError = payload;
        }
    },
    actions: {},
    modules: {
        app,
        user,
        sysAuditLog,
        sysConfigs,
        sysRole,
        sysResManager,
        sysResAudit,
        sysDict,
        sysOrg,
        sysAtta,
        common,
        authorizeUKey
    },
    /*plugins: [createPersistedState({ storage: window.sessionStorage })]*/
})
